<template>
  <div class="page-search">
    <mg-form v-bind="props.searchFormConfig" v-model="formData">
      
    </mg-form>
  </div>
</template> 
<script setup lang="ts">
import MgForm from '@/base-ui/form';
import { IForm } from '@/base-ui/form/types';
import { defineProps, ref } from 'vue';
const props = defineProps({
  // 外部传递进来的配置文件
  searchFormConfig: {
    type: Object as () => IForm,
    required: true
  }
})

// 自定义组件双向绑定, 需要定义modelValue, 属性应该由配置文件的 field 来决定
// 1. 优化一: formdata 中的属性应该动态来决定
const formItems = props.searchFormConfig?.formItems ?? []
const formOriginData: any = {}
for (const item of formItems) {
  formOriginData[item.field] = ''
}
const formData = ref(formOriginData)



</script>
<style lang="less" scoped>

</style>